<template>
	<page-body>
		<view class="page">
			<view class="flex benben-position-layout flex flex-wrap align-center yhpc_flex_0_higd"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex flex-wrap align-center justify-between flex-sub yhpc_fd0_0_higd'>
					<view class='flex flex-wrap align-center yhpc_fd0_0_c0_higd' @tap.stop="handleJumpDiy"
						data-type="back" data-url="1">
						<text class='fu-iconfont2  yhpc_fd0_0_c0_c0_higd'>&#xE794;</text>
					</view>
					<view class='flex flex-wrap align-stretch justify-center'>
						<text class='yhpc_fd0_0_c1_c0_higd' v-if=" type=='1'">{{$t('排查隐患任务详情')}}</text><text
							class='yhpc_fd0_0_c1_c0_higd' v-if=" type=='2'">{{$t('隐患排查任务详情')}}</text><text
							class='yhpc_fd0_0_c1_c0_higd' v-if=" type=='3'">{{$t('问题审核')}}</text>
					</view>
					<view class='flex flex-wrap align-center justify-end yhpc_fd0_0_c0_higd'>
					</view>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			<!---flex布局flex布局开始-->
			<view class="flex flex-direction align-stretch benben-flex-layout">
				<view class='flex flex-direction align-stretch yhpc_fd1_0_higd'>
					<view class='flex flex-direction align-stretch yhpc_fd1_0_c0_higd'>
						<view class='flex flex-wrap align-center yhpc_fd1_0_c0_c0_higd'>
							<text class='yhpc_fd1_0_c0_c0_c0_higd'>{{$t('隐患排查任务编号')}}</text>
							<text class='yhpc_fd1_0_c0_c0_c1_higd' v-if=" type=='1'">{{data.info.rwbh}}</text><text
								class='yhpc_fd1_0_c0_c0_c1_higd'>{{data.info.yhpcrw_rwbh}}</text><text
								class='yhpc_fd1_0_c0_c0_c1_higd' v-if=" type=='3'">{{data.info.fxpgrw_rwbh}}</text>
						</view>
						<view class='flex flex-wrap align-center yhpc_fd1_0_c0_c0_higd'>
							<text class='yhpc_fd1_0_c0_c0_c0_higd'>{{$t('任务执行时间')}}</text>
							<text class='yhpc_fd1_0_c0_c0_c1_higd'>{{data.info.start_time}}</text>
						</view>
						<view class='flex flex-wrap align-center yhpc_fd1_0_c0_c0_higd'>
							<text class='yhpc_fd1_0_c0_c0_c0_higd'>{{$t('所属模板')}}</text>
							<text class='yhpc_fd1_0_c0_c0_c1_higd'
								v-if=" type=='1'">{{data.info.yhpcmb_mbmc}}</text><text class='yhpc_fd1_0_c0_c0_c1_higd'
								v-if=" type=='2'">{{data.info.yhnr_mc}}</text><text class='yhpc_fd1_0_c0_c0_c1_higd'
								v-if=" type=='3'">{{data.info.mbmc}}</text>
						</view>
						<view class='flex flex-wrap align-center yhpc_fd1_0_c0_c0_higd'>
							<text class='yhpc_fd1_0_c0_c0_c0_higd'>{{$t('所属计划')}}</text>
							<text class='yhpc_fd1_0_c0_c0_c1_higd'>{{data.info.yhpcjh_jhmc}}</text>
						</view>
						<view class='flex flex-wrap align-center yhpc_fd1_0_c0_c4_higd' v-if=" type=='1'">
							<image class='yhpc_fd1_0_c0_c4_c0_higd' mode="aspectFit" :src='STATIC_URL+"102.png"'
								v-if=" data.info.rwzt=='1'"></image>
							<image class='yhpc_fd1_0_c0_c4_c0_higd' mode="aspectFit" :src='STATIC_URL+"103.png"'
								v-if=" data.info.rwzt=='2'"></image>
							<image class='yhpc_fd1_0_c0_c4_c0_higd' mode="aspectFit" :src='STATIC_URL+"104.png"'
								v-if=" data.info.rwzt=='3'"></image>
							<text class='yhpc_fd1_0_c0_c4_c1_higd' v-if=" data.info.rwzt=='1'">{{$t('待排查')}}</text><text
								class='yhpc_fd1_0_c0_c4_c1_higd' v-if=" data.info.rwzt=='2'">{{$t('排查中')}}</text><text
								class='yhpc_fd1_0_c0_c4_c1_higd' v-if=" data.info.rwzt=='3'">{{$t('已完成')}}</text>
						</view>
						<view class='flex flex-wrap align-center yhpc_fd1_0_c0_c4_higd' v-if=" type=='2'">
							<image class='yhpc_fd1_0_c0_c4_c0_higd' mode="aspectFit" :src='STATIC_URL+"102.png"'
								v-if=" data.info.zg_status=='1'"></image>
							<image class='yhpc_fd1_0_c0_c4_c0_higd' mode="aspectFit" :src='STATIC_URL+"103.png"'
								v-if=" data.info.zg_status=='2'"></image>
							<image class='yhpc_fd1_0_c0_c4_c0_higd' mode="aspectFit" :src='STATIC_URL+"104.png"'
								v-if=" data.info.zg_status=='3'"></image>
							<text class='yhpc_fd1_0_c0_c4_c1_higd'
								v-if=" data.info.zg_status=='1'">{{$t('待整改')}}</text><text
								class='yhpc_fd1_0_c0_c4_c1_higd'
								v-if=" data.info.zg_status=='2'">{{$t('整改中')}}</text><text
								class='yhpc_fd1_0_c0_c4_c1_higd' v-if=" data.info.zg_status=='3'">{{$t('已完成')}}</text>
						</view>
						<view class='flex flex-wrap align-center yhpc_fd1_0_c0_c4_higd' v-if=" type=='3'">
							<image class='yhpc_fd1_0_c0_c4_c0_higd' mode="aspectFit" :src='STATIC_URL+"102.png"'
								v-if=" data.info.sh_status=='1'"></image>
							<image class='yhpc_fd1_0_c0_c4_c0_higd' mode="aspectFit" :src='STATIC_URL+"103.png"'
								v-if=" data.info.sh_status=='2'"></image>
							<image class='yhpc_fd1_0_c0_c4_c0_higd' mode="aspectFit" :src='STATIC_URL+"104.png"'
								v-if=" data.info.sh_status=='3'"></image>
							<text class='yhpc_fd1_0_c0_c4_c1_higd'
								v-if=" data.info.sh_status=='1'">{{$t('待审核')}}</text><text
								class='yhpc_fd1_0_c0_c4_c1_higd'
								v-if=" data.info.sh_status=='2'">{{$t('审核中')}}</text><text
								class='yhpc_fd1_0_c0_c4_c1_higd' v-if=" data.info.sh_status=='3'">{{$t('已完成')}}</text>
						</view>
					</view>
				</view>
				<view class='flex flex-direction align-stretch yhpc_fd1_1_higd'>
					<view class='flex flex-wrap align-center yhpc_fd1_1_c0_higd'>
						<text class='yhpc_fd1_1_c0_c0_higd'>{{$t('隐患排查项')}}</text>
					</view>
					<view class='flex flex-direction align-stretch'>
						<template v-for='(item,key0) in data.list'>
							<view class='flex flex-direction align-stretch yhpc_fd1_1_c1_c0_higd'
								@tap.stop="jumpFunc(item)" :key='key0'>
								<view class='flex flex-wrap align-center justify-between yhpc_fd1_0_c0_c0_higd'>
									<view class='flex flex-wrap align-center'>
										<text v-if=" type=='1'">{{item.mc}}</text><text
											v-if=" type=='2'">{{item.mc}}</text><text
											v-if=" type=='3'">{{item.mc}}</text>
									</view>
									<view class='flex flex-wrap align-center'>
										<view class='flex flex-wrap align-center yhpc_fd1_1_c1_c0_c0_c1_c0_higd'
											v-if=" type=='1'">
											<text class='yhpc_fd1_1_c1_c0_c0_c1_c0_c0_higd'
												v-if=" item.pczt=='1'">{{$t('未排查')}}</text><text
												class='yhpc_fd1_1_c1_c0_c0_c1_c0_c0_1_higd'
												v-if=" item.pczt=='2'">{{$t('已排查')}}</text>
										</view>
										<view class='flex flex-wrap align-center yhpc_fd1_1_c1_c0_c0_c1_c0_higd'
											v-if=" type=='2'">
											<text class='yhpc_fd1_1_c1_c0_c0_c1_c1_c0_higd'
												v-if=" item.wtzt=='1'">{{$t('待整改')}}</text><text
												class='yhpc_fd1_1_c1_c0_c0_c1_c1_c0_1_higd'
												v-if=" item.wtzt=='2'">{{$t('待审核')}}</text>
												<text class='yhpc_fd1_1_c1_c0_c0_c1_c1_c0_1_higd'
													v-if=" item.wtzt=='4'">{{$t('审核拒绝')}}</text>
												<text
												class='yhpc_fd1_1_c1_c0_c0_c1_c1_c0_2_higd'
												v-if=" item.wtzt=='3'">{{$t('已完成')}}</text>
										</view>
										<view class='flex flex-wrap align-center yhpc_fd1_1_c1_c0_c0_c1_c0_higd'
											v-if=" type=='3'">
											<text class='yhpc_fd1_1_c1_c0_c0_c1_c2_c0_higd'
												v-if=" item.wtzt=='1'">{{$t('待审核')}}</text><text
												class='yhpc_fd1_1_c1_c0_c0_c1_c2_c0_1_higd'
												v-if=" item.wtzt=='2'">{{$t('已完成')}}</text>
												<text class='yhpc_fd1_1_c1_c0_c0_c1_c2_c0_higd'
													v-if=" item.wtzt=='4'">{{$t('审核拒绝')}}</text>
										</view>
										<text class='fu-iconfont2'>&#xe7f2;</text>
									</view>
								</view>
								<view class='flex flex-wrap align-center yhpc_fd1_1_c1_c0_c1_higd'>
									<text class='yhpc_fd1_1_c1_c0_c1_c0_higd'>{{item.pc_info}}</text>
								</view>
							</view>
						</template>

					</view>
				</view>
			</view>

			<!---flex布局flex布局结束-->


		</view>
	</page-body>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'

	export default {
		components: {},


		data() {
			return {
				/** mbmc【模板】
				 *   sh_status【状态】
				 *   zg_status【状态】
				 *   yhpcrw_rwbh【编号】
				 *   yhnr_mc【模板】
				 *   yhpcmb_mbmc【模板】
				 *   yhpcjh_jhmc【计划】
				 *   rwzt【状态】
				 *   rwbh【编号】 **/
				"data": {
					"info": {
						"rwbh": "",
						"rwzt": "",
						"start_time": "",
						"yhpcjh_jhmc": "",
						"yhpcmb_mbmc": "",
						"rwzt_name": "",
						"yhnr_mc": "",
						"yhpcrw_rwbh": "",
						"zg_status": "",
						"sh_status": "",
						"mbmc": ""
					},
					"list": []
				},
				"aid": "",
				/** status【排查项状态】 **/ "status": "",
				/** title【标题】 **/ "title": "",
				"ids": "",
				"id": "",
				"type": ""
			};
		},
		computed: {

		},
		watch: {},
		onLoad(options) {
			let {
				id,
				type
			} = options
			if (id !== undefined) this.id = id
			if (type !== undefined) this.type = type
			this.getinfoFunc()
			this.diyPageListen()
		},
		onUnload() {
			this.diyOffPageListen()
		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//获取数据
			getinfoFunc() {
				console.log(this.type)
				console.log(this.id)
				if (this.type == '1') {
					this.getip73ece89cbc1eFunc()
				} else if (this.type == '2') {
					this.getid73edf8a062ebFunc()
				} else if (this.type == '3') {
					this.getpf741905e62864Func()
				}
			},
			//查询隐患排查任务详情
			async getip73ece89cbc1eFunc() {
				//请求方法
				//数据验证

				let datadata = await this.$api.get(global.apiUrls.post673ece89cbc1e, {
					aid: this.id
				});

				if (datadata.data.code != 1) {
					this.$message.info(datadata.data.msg);
					return
				}
				let infodata = datadata.data;
				this.data = infodata.data

			},
			//查询隐患排查问题整改
			async getid73edf8a062ebFunc() {
				//请求方法
				//数据验证

				let datadata = await this.$api.get(global.apiUrls.post673edf8a062eb, {
					yhpcrw_id: this.id
				});

				if (datadata.data.code != 1) {
					this.$message.info(datadata.data.msg);
					return
				}
				let infodata = datadata.data;
				this.data = infodata.data

			},
			//查询问题审核-隐患排查
			async getpf741905e62864Func() {
				//请求方法
				//数据验证

				let datadata = await this.$api.get(global.apiUrls.post6741905e62864, {
					yhpcrw_id: this.id
				});

				if (datadata.data.code != 1) {
					this.$message.info(datadata.data.msg);
					return
				}
				let infodata = datadata.data;
				this.data = infodata.data

			},
			//跳转页面
			jumpFunc(item) {
				if (this.type == 1) {
					this.status = item.pczt
					this.title = item.mc
				} else if (this.type == 2) {
					this.status = item.wtzt
				} else {
					this.status = item.wtzt
				}
				console.log(this.type)
				console.log(this.status)
				console.log(item.yhnr_id)
				//return
				//跳转排查
				if (this.type == 1 && this.status == 1) {
					this.aid = item.aid
					this.ids = item.yhnr_id
					this.jumppcFunc()
				}
				//排查完 异常的 跳转详情  pcjg 1正常 2异常
				// if (this.type == 1 && this.status == 2 && item.pcjg == 2) {
				if (this.type == 1 && this.status == 2 ) {
					this.title = item.mc
					this.aid = item.pcjg_id
					this.ids = item.yhnr_id
					this.jumppcdetailsFunc()

				}

				//跳转整改 1 待整改 2待审核 3已完成
				if (this.type == 2 && this.status == 1) {
					this.title = item.mc
					this.aid = item.aid
					this.ids = item.yhnr_id
					this.jumppcdzgFunc()
				}
				//整改完 跳转待审核页面  正常的跳转详情
				if (this.type == 2 && (this.status == 2 || this.status == 3)) {
					this.title = item.mc
					this.aid = item.aid
					this.ids = item.yhnr_id
					this.jumppcdetailsFunc()

				}
				//审核列表 正常的跳转详情
				if (this.type == 3 && this.status == 2) {
					this.title = item.mc
					this.aid = item.aid
					this.ids = item.yhnr_id
					this.jumppcdetailsFunc()
				
				}
				//待审核 审核 拒绝 跳转待审核
				if ((this.type == 3 && (this.status == 1 || this.status == 4)) || (this.type == 2 && this.status == 4)) {
					this.title = item.mc
					this.aid = item.aid
					this.ids = item.yhnr_id
					this.jumpshFunc()

				}


			},
			//跳转排查
			jumppcFunc() {
				console.log(this.aid)
				console.log(this.title)
				this.$urouter.navigateTo(`/pageyhpc/yhpc/kspc/kspc?id=${this.aid}&title=${this.title}&ids=${this.ids}`);
			},
			//跳转排查详情
			jumppcdetailsFunc() {
				this.$urouter.navigateTo(
					`/pageyhpc/yhpc/yhpcdetail/yhpcdetail?id=${this.aid}&title=${this.title}&ids=${this.ids}&type=${this.type}`
					);
			},
			//跳转整改
			jumpzgdetailsFunc() {
				this.$urouter.navigateTo(`/pageyhpc/yhpc/yhzg/yhzg?id=${this.aid}&title=${this.title}`);
			},
			//跳转待整改
			jumppcdzgFunc() {
				this.$urouter.navigateTo(`/pageyhpc/yhpc/yhdzg/yhdzg?id=${this.aid}&title=${this.title}&ids=${this.ids}`);
			},
			//跳转审核
			jumpshFunc() {
				this.$urouter.navigateTo(
					`/pageyhpc/yhpc/yhsh/yhsh?id=${this.aid}&title=${this.title}&ids=${this.ids}&type=${this.type}&shzt=${this.status}`
					);
			},
			//页面监听
			diyPageListen() {
				uni.$on('pc', (data) => {
					this.getinfoFunc()
				});
				uni.$on('yhsh', (data) => {
					this.getinfoFunc()
				});
				uni.$on('tjypc', (data) => {
					this.getinfoFunc()
				});
			},
			//注销页面监听
			diyOffPageListen() {
				uni.$off('pc');
				uni.$off('yhsh');
				uni.$off('tjypc');
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: #F8F8F8;
		background-size: 100% auto;

		.yhpc_fd1_0_higd {
			width: 100%;
			padding: 16rpx 32rpx 16rpx 32rpx;

			.yhpc_fd1_0_c0_higd {
				background: rgba(255, 255, 255, 1);
				background-size: 100% auto;
				border-radius: 16rpx;
				padding: 0rpx 24rpx 0rpx 24rpx;
				color: rgba(153, 153, 153, 1);
				font-size: 28rpx;
				position: relative;
			}
		}

		.yhpc_fd1_0_c0_c0_higd {
			line-height: 88rpx;
		}

		.yhpc_fd1_0_c0_c0_c0_higd {
			width: 250rpx;
		}

		.yhpc_fd1_0_c0_c0_c1_higd {
			color: #333;
		}

		.yhpc_fd1_0_c0_c4_higd {
			color: var(--benbenFontColor3);
			font-size: 24rpx;
			position: absolute;
			right: 0rpx;
			width: 116rpx;
			height: 48rpx;
			text-align: center;
		}

		.yhpc_fd1_0_c0_c4_c0_higd {
			width: 116rpx;
			height: 48rpx;
			border-radius: 0rpx;
			position: absolute;
			right: 0rpx;
			z-index: 2;
		}

		.yhpc_fd1_0_c0_c4_c1_higd {
			width: 116rpx;
			height: 48rpx;
			text-align: center;
			position: relative;
			right: 0rpx;
			z-index: 2;
			line-height: 48rpx;
		}

		.yhpc_fd1_1_higd {
			background: rgba(255, 255, 255, 1);
			background-size: 100% auto;
			margin: 0rpx 32rpx 0rpx 32rpx;

			.yhpc_fd1_1_c0_higd {
				line-height: 88rpx;
				padding: 0rpx 0rpx 0rpx 24rpx;

				.yhpc_fd1_1_c0_c0_higd {
					color: #333;
					font-size: 32rpx;
					font-weight: 500;
				}
			}

			.yhpc_fd1_1_c1_c0_higd {
				padding: 0rpx 24rpx 0rpx 24rpx;
				margin: 0rpx 0rpx 32rpx 0rpx;
				background: rgba(255, 255, 255, 1);
				background-size: 100% auto;
				border-radius: 16rpx;
				border-bottom: 1px solid #eee;

				.yhpc_fd1_1_c1_c0_c1_higd {
					line-height: 66rpx;

					.yhpc_fd1_1_c1_c0_c1_c0_higd {
						color: rgba(153, 153, 153, 1);
						font-size: 24rpx;
					}
				}
			}
		}

		.yhpc_fd1_1_c1_c0_c0_c1_c0_higd {
			height: 40rpx;

			.yhpc_fd1_1_c1_c0_c0_c1_c0_c0_higd {
				color: var(--benbenFontColor6);
				font-size: 24rpx;
				line-height: 40rpx;
				text-align: center;
				width: 96rpx;
				height: 40rpx;
				border: 1px solid var(--benbenbdColor3);
				border-radius: 8rpx;
			}

			.yhpc_fd1_1_c1_c0_c0_c1_c0_c0_1_higd {
				color: var(--benbenFontColor3);
				height: 40rpx;
				line-height: 40rpx;
				font-size: 24rpx;
				width: 96rpx;
				text-align: center;
				border-radius: 8rpx;
				background: var(--benbenbgColor9);
				background-size: 100% auto;
			}
		}

		.yhpc_fd1_1_c1_c0_c0_c1_c1_c0_higd {
			color: var(--benbenFontColor6);
			font-size: 24rpx;
			line-height: 40rpx;
			text-align: center;
			width: 96rpx;
			border-radius: 8rpx;
			border: 1px solid var(--benbenbdColor3);
		}

		.yhpc_fd1_1_c1_c0_c0_c1_c1_c0_1_higd {
			color: rgba(235, 149, 75, 1);
			border: 1px solid rgba(235, 149, 75, 1);
			height: 40rpx;
			line-height: 40rpx;
			font-size: 24rpx;
			text-align: center;
			width: 96rpx;
			border-radius: 8rpx;
		}

		.yhpc_fd1_1_c1_c0_c0_c1_c1_c0_2_higd {
			color: var(--benbenFontColor3);
			font-size: 24rpx;
			line-height: 40rpx;
			text-align: center;
			width: 96rpx;
			border-radius: 8rpx;
			height: 40rpx;
			background: var(--benbenbgColor9);
			background-size: 100% auto;
		}

		.yhpc_fd1_1_c1_c0_c0_c1_c2_c0_higd {
			color: var(--benbenFontColor6);
			font-size: 24rpx;
			line-height: 40rpx;
			text-align: center;
			width: 96rpx;
			border-radius: 8rpx;
			height: 40rpx;
			border: 1px solid var(--benbenbdColor3);
		}

		.yhpc_fd1_1_c1_c0_c0_c1_c2_c0_1_higd {
			color: var(--benbenFontColor3);
			height: 40rpx;
			line-height: 40rpx;
			font-size: 24rpx;
			text-align: center;
			border-radius: 8rpx;
			background: var(--benbenbgColor9);
			background-size: 100% auto;
			width: 96rpx;
		}

		.yhpc_flex_0_higd {
			width: 750rpx;
			height: 88rpx;
			overflow: hidden;
			z-index: 10;
			top: 0rpx;
			background: #fff;
			background-size: 100% auto !important;

			.yhpc_fd0_0_higd {
				padding: 0rpx 32rpx 0rpx 32rpx;
			}
		}

		.yhpc_fd0_0_c0_higd {
			width: 120rpx;

			.yhpc_fd0_0_c0_c0_higd {
				font-size: 36rpx;
				color: #333;
			}
		}

		.yhpc_fd0_0_c1_c0_higd {
			font-size: 36rpx;
			font-weight: 700;
			color: #333333;
			line-height: 50rpx;
		}
	}
</style>
